const Generator = require('yeoman-generator')

module.exports = class extends Generator {
    prompting() {
        return this.prompt([{
            type: 'input',
            name: 'name',
            message: 'Your npm package name',
            default: this.appname
        }])
        .then((answers) => {
            this.answers = answers
        })
    }

    writing () {
        const paths = [
            'lib/index.js',
            '.editorconfig',
            '.gitignore',
            'CHANGELOG.md',
            'LICENSE',
            'package.json',
            'README.md'
        ]
        paths.forEach((item) => {
            this.fs.copyTpl(
                this.templatePath(item),
                this.destinationPath(item),
                this.answers
            )
        })
    }
}